<?php
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/js/jquery.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/global.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/index.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/font-awesome.min.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/Font-Awesome-3.2.1/css/font-awesome.min.css");
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/alert.js",CClientScript::POS_HEAD);

Yii::app()->clientScript->registerCss("CSS1","
    .cont_box img{
        height: 200px;
    }

   #loadings {
        left: 50%;
        position: absolute;
        top: 50%;
    }

");


?>
<style type="text/css">
    .main-box {
        background: #FCE77C url("<?php echo $this->staticsPath."/img/userinfo2.png" ?>") no-repeat scroll 0 0 / 100% auto;
        height: 100%;
        left: 0;
        margin: 0 auto;
        position: absolute;
        top: 0;
        width: 100%;
        z-index: -1;
    }
    .morcon {
        height: 100px;
        margin: 245px 20px 20px;
        position: relative;
        text-align: center;
    }

    .morcon .reg {
        background: rgba(255, 255, 255, 0) none repeat scroll 0 0;
        border: medium none;
        color: #fff;
        font-size: 20px;
        left: 4%;
        position: absolute;
        top: 0;
    }
    .morcon .login {
        background: rgba(255, 255, 255, 0) none repeat scroll 0 0;
        border: medium none;
        color: #fff;
        display: block;
        font-size: 20px;
        left: 51%;
        position: absolute;
        top: 39%;
    }

    .wrap .header{
        width: 100%;
        position: relative;
        height: 300px;
    }
    .wrap .footer {
        height: 350px;
        position: relative;
        width: 100%;
    }

    .wrap .header .mydodo{
         background: url("<?php echo $this->staticsPath."/img/mydodo.png" ?>") no-repeat scroll 0 0 / 150px auto;
         height: 40px;
         width: 150px;
         position: absolute;
         right: 15px;
         top: 25px;
     }
    .wrap .header .imgbg{
        background: url("<?php echo $this->staticsPath."/img/imgbg.png" ?>") no-repeat scroll 0 0 / 150px auto;
        height: 150px;
        width: 150px;
        position: absolute;
        left: 15px;
        top: 90px;
    }
    .imgbg .box{
        width: 100%;
        height: 100%;
        position: relative;
    }
    .imgbg .box img {
        border-radius: 50%;
        height: 80%;
        left: 15px;
        position: absolute;
        top: 15px;
        width: 80%;
    }
    .wrap .header .hname {
        height: 200px;
        left: 170px;
        position: absolute;
        top: 144px;
        width: 200px;
    }
    .wrap .header .hname p{
        color: #0066b3;
        font-size: 18px;
    }
    .wrap .header .list {


        height: 80px;
        left: 25px;
        position: absolute;
        top: 25px;
        width: 80px;
    }
    .wrap .header .list a{
        color: #0066b3;
        font-size: 30px;
    }
    .wrap .footer .fbotton{
        width: 33%;
        height: 150px;
        float: left;
    }
    .wrap .footer .fbotton .like{
        background: url("<?php echo $this->staticsPath."/img/t1.png" ?>") no-repeat scroll 20px 0 / 80px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .collection{
        background: url("<?php echo $this->staticsPath."/img/t2.png" ?>") no-repeat scroll 21px 0 /80px auto;
        height: 100%;
        width: 100%;
        z-index:5;
    }
    .wrap .footer .fbotton .share{
        background: url("<?php echo $this->staticsPath."/img/t3.png" ?>") no-repeat scroll 13px 0 / 80px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .point{
        background: url("<?php echo $this->staticsPath."/img/sc.png" ?>") no-repeat scroll 6px 0 / 104px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .pointlist{
        background: url("<?php echo $this->staticsPath."/img/pointlist.png" ?>") no-repeat scroll 13px 0 / 90px auto;
        height: 100%;
        width: 100%;
    }
    .wrap .footer .fbotton .pointgift{
        background: url("<?php echo $this->staticsPath."/img/pointgift.png" ?>") no-repeat scroll 13px 11px / 90px auto;
        height: 100%;
        width: 100%;
    }
    .header a {
        display: inline;
    }
    body{
        background-color: #FCE77C;
        /*background-attachment: fixed;*/
        /*background-size:cover*/
    }
    .footers .bt{
        width: 33%;
        float: left;
        height: 100%;
    }
    .footers .bt .tj{
        background: url("<?php echo $this->staticsPath."/img/tj.png" ?>") no-repeat scroll 12px 0 / 94px auto;
        height: 100%;
        width: 100%;
    }
    .footers .bt .gr{
        background: url("<?php echo $this->staticsPath."/img/gr.png" ?>") no-repeat scroll 9px 9px / 94px auto;
        height: 100%;
        width: 100%;
    }
    .footers .bt .yd{
        background: url("<?php echo $this->staticsPath."/img/yd.png" ?>") no-repeat scroll 6px 9px / 94px auto;
        height: 100%;
        width: 100%;
    }
    .footers {
        bottom: 0;
        height: 68px;
        position: fixed;
        width: 100%;
    }

    .hname a{
        font-size: 18px;
    }







</style>
<?php if($status=='no'){ ?>
    <div  class="loading" style="display: block">
        <div id="loading">
            <div id="loadings">
                <i class="fa fa-cog fa-spin"></i>
            </div>
        </div>
    </div>
<?php } ?>
<div class="data"  <?php if($status=='no'){ ?>style="display: none"<?php } ?>>
    <div class="main-box"></div>
    <section class="wrap" style="height:320px;">

        <div class="footer">
             <div class="fbotton " style="height:100px;margin-top:60%;"><div id="like" class="like"></div><div style="margin-left:20px;font-size:18px;color:#886600;font-weight:bold; ">我的作品</div></div>
            <div class="fbotton" style="height:100px;margin-top:55%;"><div id="collection" class="collection"></div><div style="margin-left:20px;font-size:18px;color:#886600;font-weight:bold; ">其他作品</div></div>
            <div class="fbotton" style="height:100px;margin-top:60%;"><div id="share" class="share"></div><div style="margin-left:20px;font-size:18px;color:#886600;font-weight:bold; ">课堂资源</div></div>
             <div class="fbotton " style="height:90px;"></div>
            <div class="fbotton" style="height:90px;margin-top:200px;"><img id="sc"   width="100%" src="<?php echo $this->staticsPath."/img/sc.png" ?>" /></div>
            <div class="fbotton" style="height:90px;"></div>
        </div>
        
    </section>

</div>

<script type="text/javascript">
    $(function(){
        var h = $(window).height();
        $('.wrap').css("height",h+"px");

        $("#mydodo").click(function(){
            window.location.href='<?php echo $this->createUrl('myQuan',array('openid'=>$openid)) ?>';
        });
        $("#like").click(function(){
            window.location.href='<?php echo $this->createUrl('opuslist',array('type'=>'1')) ?>';
        });
        $("#collection").click(function(){
            window.location.href='<?php echo $this->createUrl('opuslist',array('type'=>'2')) ?>';
        });
        $("#share").click(function(){
            window.location.href='<?php echo $this->createUrl('opusTList',array('type'=>'3')) ?>';
        });
        $("#point").click(function(){
            window.location.href='<?php echo $this->createUrl('myPoint',array('openid'=>$openid)) ?>';
        });
        $("#sc").click(function(){
            window.location.href='<?php echo $this->createUrl('opusfilelist',array('openid'=>$openid)) ?>';
        });
        $("#exchange").click(function(){
            window.location.href='<?php echo $this->createUrl('myExchange',array('openid'=>$openid)) ?>';
        });
    });
    <?php if($status=='no'){ ?>
    $(function(){
        var storage = window.localStorage;
        var stroeUser = storage["stroeUser"];
        $.ajax({
            type: "POST",
            url: '<?php echo Yii::app()->createUrl('user/ajaxCheckUser'); ?>',
            data: {
                stroeUser:stroeUser
            },
            dataType: "json",
            success: function (data) {
                if (data) {
                    if(data.status==1){
                        window.location.reload();
                    }else{
                        window.location.href='<?php echo Yii::app()->createUrl('index/login',array('openid'=>$openid)); ?>';
                    }
                }else{
                    window.location.href='<?php echo Yii::app()->createUrl('index/login',array('openid'=>$openid)); ?>';
                }
            }
        });

    });
    <?php } ?>






    $(function(){
        var sitchlock = true;

        $("#switch").click(function(){
            if(sitchlock==true){

                    if(window.confirm('你确定要切换成家长账号吗？')){
                    $.ajax({
                        type: "POST",
                        url: '<?php echo Yii::app()->createUrl('index/ajaxSwitch'); ?>',
                        dataType: "json",
                        data: {
                            openid:'<?php echo $openid; ?>'
                        },
                        beforeSend : function() {
                            sitchlock = false;
                        },
                        success: function (data) {
                            if (data) {
                                if(data.status==1){
                                    sitchlock = true;
                                    window.localStorage["stroeUser"] = data.key;
                                    window.location.reload();
                                }else if(data.status==3){
                                    sitchlock = true;
                                    window.location.href='<?php echo Yii::app()->createUrl('index/register',array('openid'=>$openid,'type'=>2)) ?>';
                                }else{
                                    sitchlock = true;
                                    alert(data.message);
                                }
                            }else{
                                sitchlock = true;
                                alert('切换失败');
                            }
                        }
                    });
                    }
            }
        });
        $("#logout").click(function(){
            if(window.confirm('你确定要退出账号吗？')){
                $.ajax({
                    type: "POST",
                    url: '<?php echo Yii::app()->createUrl('index/ajaxLogout'); ?>',
                    dataType: "json",
                    success: function (data) {
                        if (data) {
                            if(data.status==1){
                                window.localStorage["stroeUser"] = '';
                                window.location.href=data.url;
                            }else{
                                alert('退出失败');
                            }
                        }else{
                            alert('退出失败');
                        }
                    }
                });
            }
        });
    });
</script>